<template>
  <div class="error-page">
      <div class="error-code"><img src="../../assets/img/404.webp" alt="页面未找到"></div>
      <div class="error-desc">抱歉，页面未找到，<span>{{countDown}}</span>s后自动跳转到系统首页</div>
      <div class="error-handle">
          <router-link to="/">
            <el-button type="primary" size="large">返回首页</el-button>
          </router-link>
          <el-button class="error-btn" type="primary" size="large" @click="goBack">返回上一页</el-button>
      </div>
  </div>
</template>

<script>
export default {
        data() {
            return {
                countDown: 10,
                timer: null
            }
        },
        methods: {
            goBack(){
                this.$router.go(-1);
            },
            goHome() {
                this.$router.push('/Dashboard')
                clearInterval(this.timer)
            }
        },
        created() {
            this.timer = setInterval(() => {
            this.countDown > 0 ? this.countDown-- : this.goHome()
            }, 1000)
        }
    }
</script>


<style scoped>
    .error-page{
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        width: 100%;
        height: 100%;
        background: #f3f3f3;
        box-sizing: border-box;
    }
    .error-code{
        line-height: 1;
        font-size: 250px;
        font-weight: bolder;
        color: #2d8cf0;
    }
    .error-code span{
        color: #00a854;
    }
    .error-desc{
        font-size: 30px;
        margin-top: -25px;
        color: #777;
        z-index: 999;
    }
    .error-handle{
        margin-top: 10px;
        padding-bottom: 200px;
        z-index: 999;
    }
    .error-btn{
        margin-left: 100px;
    }
    img {
        width: 1200px;
        height: 600px;
        position:relative;
        top:150px;
        z-index: 0;
    }
</style>
